<?php
echo $html->css ( 'tab' );
echo $html->css ( 'jquery-validate/css/screen' );
?>
<script type="text/javascript">
//Form验证
$(document).ready(function() {
	 $.validator.setDefaults({       
		 submitHandler: function(form) {    
		  form.submit();    
		}       
	});
	 jQuery.validator.setDefaults({
			debug: true
		});;	
});
	function getDelStr() {
		var delArr = $("#SalaryareaSalaryareasDelForm :checkbox:checked");
		if(delArr.length==0)
		{
			alert("请选择你要删除的项!");
			return;
		}
		var str = "";
		for(var i=0;i<delArr.length;i++) {
			var del = delArr[i].value;
			str += del;
			str += "/";
		}
		//window.alert(str);
		$("#delStr").val(str);
		//window.alert($("#delStr").val());
		$("#SalaryareaSalaryareasDelForm").submit();
	}

	function editType(id) {
		$(".id3").val(id);
		$("#f3").submit();
	}

	function delType(id) {
		if(!confirm("确定删除?")) {
			return false;
		}
		$(".ids").val(id);
		$("#f2").submit();
	}

	$(document).ready(function(){
		
		$("#btnajaxAdd").click(function(){
			var n=$("#ho1").val();
			$(".ho").val(n);
			// validate signup form on keyup and submit
			$("#f1").validate({
				rules: {
					name:{
						required: true,alowsome: true,stringMinLength:0,stringMaxLength:20
					}
				},
				messages: {
					name:{
					required:  "请输入制度类型名称",stringMinLength:"制度类型名称长度必须大于0个字符",stringMaxLength:"制度类型名称长度必须小于20个字符"
						
					}
				},
				//设置验证触发事件 
				focusInvalid: false, 
				onkeyup: false, 
				//设置错误信息提示DOM  
				errorPlacement: function(error, element) { 
				error.appendTo( element.parent()); 
				}
			});
			$("#f1").submit();
			});
});
</script>
<!-- 当前位置-->
<div id="tabmenubar">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td class="tabmenubartitle1"><?php echo  __('YourPosition');//您现在的位置：?></td>
		<td class="tabmenubartitle2"><?php echo __('Personal Office');//一级目录
										   echo '>';echo __('Business Manage');//二级目录
										   echo '>';?>
									<?php echo $html->tag('span', __('Category Manage',true));//当前操作地用span加粗?> 						  
		</td>
	</tr>
</table>
</div>
<!-- 当前位置-->
<form action="<?php echo ROOT_WEB_PATH; ?>/businessmanagecategories/add" method="post" id="f1">
<input type="hidden" name="name" class="ho"></input>
</form>
<form action="<?php echo ROOT_WEB_PATH; ?>/businessmanagecategories/delSome" id="f2" method="post">
<input type="hidden" name="ids" class="ids"></input>
</form>
<form action="<?php echo ROOT_WEB_PATH; ?>/businessmanagecategories/edit" id="f3" method="post">
<input type="hidden" name="id" class="id3"></input>
</form>
 <!-- 当前位置-->
<?php  echo $form->create('del',array('action'=>'addholidaytype','type'=> 'post'));?>
<?php  echo $form->hidden('delStr',array('name'=>'salaryareaid','id'=>'delStr'));?>

<div id="nav1" style="width:28%;margin-left:200px;">
<fieldset><legend><?php __('add').__('Manage Category');?></legend>
		<table width="98%" cellspacing="0" cellpadding="0" border="0" >
			<tr>
				<td width="80px"><?php __('Manage Category'); ?>：
				</td>
				<td >
				
				<input type="text" name="name" class="TextBoxE1" id="ho1" size="80"></input>
				
					<!--<?php echo $form->text('Field1',array('class' => 'TextBoxL txtOut','id'=>'addHolidaytype','name'=>'name')); ?>
					
				--></td>
				<td width="20px">
					<a><input type="button" value="添加" id="btnajaxAdd" class="btn2" /></a>
					 <!--添加 -->
				</td>
			</tr>
			</table>
</fieldset>
</div>

 <!-- 假期类型列表 -->
<div id="nav1" style="width:45%;margin-left:200px;">
<table width="100%" cellpadding="0" cellspacing="0" class="tab1">
	<tr>
		<th><?php echo __('Manage Category');?></th>
		<th width="80px">删除</th>
	</tr>
	<!-- Here's where we loop through our $Notes array, printing out post info --> 
	
	<?php 
	foreach ($result as $row): 
	?>
		<tr class=normal onmouseover='this.className= "over " '
			 onmouseup='this.className= "over " '
			 onmouseout='this.className= "normal " '>
			<td title="<?php echo $row['Businessmanagecategory']['name']; ?>"><?php echo $row['Businessmanagecategory']['name']; ?></td>
			<td><a><?php echo $html->image('delete.gif', array('alt' =>  __('Delete', true),'border'=>'0','onclick'=>"delType({$row['Businessmanagecategory']['id']});"));?></a></td>
		</tr> 
	<?php endforeach; ?>
</table>
</div>
<!-- 假期类型列表-->
<?php echo $form->end();?>